<!DOCTYPE html>
<html ng-app="app">
<head>    
    <title>可来居</title>
    <meta charset="utf-8">    
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="keywords" content="可来居,待到你我一起可来,只住得下你我的可来居" />
    <meta name="description" content="可来居(www.goodmw.cn)抒发心情,记录生活的只言片语,生活中的相册,温暖的小视频,有感而发的诗词" />
    <link rel="shortcut icon" href="__PUBLIC__/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="__PUBLIC__/client/css/common.css">
    <link rel="stylesheet" href="__PUBLIC__/client/css/index.min.css">   
    <link rel="stylesheet" href="__PUBLIC__/client/fonts/iconfont.css">   
    <script type="text/javascript">
        (function(){
            var staticPath = {
                    'style' : [
                            '__PUBLIC__/client/css/bootstrap.min.css'
                        ],
                    'script' : [
                        '__PUBLIC__/client/js/common/angular.min.js',
                        '__PUBLIC__/client/js/common/angular-route.min.js'
                    ]
                },

                staticText = {},
                staticElem,                 
                headElem = document.getElementsByTagName('head')[0];
                titleElem = document.getElementsByTagName('link')[0].nextSibling;

            //加载 静态css
            function getStatic(staticPath) { 
                for(key in staticPath) { 
                    for(var i = 0, len = staticPath[key].length; i < len; i++) {
                        staticText[key] = localStorage.getItem("static-"+key+"-"+i);
                        if(staticText[key]) {  
                            staticElem = document.createElement(key);               
                            staticElem.innerHTML = staticText[key];
                            headElem.insertBefore(staticElem, titleElem);
                        }else {                            
                            doGet(staticPath[key][i], key, i); 
                        }
                    }
                }
            }   

            //简单的ajax
            function doGet(url, static, i){ 
                var XHR=null;  
                if (window.XMLHttpRequest) {  
                    XHR = new XMLHttpRequest();  
                } else {  
                    XHR = null;  
                }  
  
                if(XHR){  
                    XHR.open("GET", url, false);                  
                    XHR.onreadystatechange = function () {  
                        if (XHR.readyState == 4 && XHR.status == 200) {  
                            elem = document.createElement(static);
                            elem.innerHTML = XHR.responseText;
                            headElem.insertBefore(elem, titleElem);
                            localStorage.setItem("static-"+static+"-"+i, XHR.responseText);
                        }  
                    };  
                    XHR.send();  
                }  
            }   
            
            getStatic(staticPath);      
        })();
    </script>
</head>
    <body>
    <header ng-controller="headCtr" class="navbar">
        <div class="container head-con">
            <nav class="touch-menu cc">
                <a class="menu-btn fl">
                    <i class="iconfont icon-category" ng-init='isShow = false' ng-click='isShow = !isShow'></i>
                </a>
                <ul class="dropdown-menu {{menuShow = isShow ? 'is-show' : ''}}" >
                    <li class="active">
                        <a href="/#/index" ng-click='isShow = !isShow'>首页</a>
                    </li>
                    <li>
                        <a href="/#/index?type=1" ng-click='isShow = !isShow'>心情</a>
                    </li>
                    <li>
                        <a href="/#/index?type=2" ng-click='isShow = !isShow'>诗文</a>
                    </li>
                    <li>
                        <a href="/#/index?type=3" ng-click='isShow = !isShow'>相册</a>
                    </li>
                    <li>
                        <a href="/#/index?type=4" ng-click='isShow = !isShow'>视频</a>
                    </li>
                    <li>
                        <a href="/#/index?type=5" ng-click='isShow = !isShow'>技能</a>
                    </li>
                </ul>
                <a href="/#/index" class="logo">可来居</a>
                <a class="home fr" ng-init='loginShow = false' ng-click='loginShow = !loginShow'>
                    <i class="iconfont icon-account"></i>
                </a>
                <?php if(session('userName')) { ?>
                <ul class="dropdown-menu menu-right {{loginMenu = loginShow ? 'is-show' : ''}}" >                  
                    <li><a href="index.php?m=home&a=logout&c=login" ng-click='loginShow = !loginShow'>退出</a></li>
                    <li><a href="/#/userInfo" ng-click='loginShow = !loginShow'>个人中心</a></li>
                    <li><a href="/#/post" ng-click='loginShow = !loginShow'>发表</a></li>
                </ul>
                <?php }else{ ?>
                <ul class="dropdown-menu menu-right {{loginMenu = loginShow ? 'is-show' : ''}}">
                    <li><a href="/#/login" ng-click='loginShow = !loginShow'>登录</a></li>
                    <li><a href="/#/login" ng-click='loginShow = !loginShow'>注册</a></li>
                </ul>
                <?php } ?>
            </nav>
            <nav class="pc-menu cc">
                <a class="logo fl" href="/#/index">可来居</a>
                <ul class="fl">
                    <li class="active">
                        <a href="/#/index">首页</a>
                    </li>
                    <li>
                        <a href="/#/index?type=1">心情</a>
                    </li>
                    <li>
                        <a href="/#/index?type=2">诗文</a>
                    </li>
                    <li>
                        <a href="/#/index?type=3">相册</a>
                    </li>
                    <li>
                        <a href="/#/index?type=4">视频</a>
                    </li>
                    <li>
                        <a href="/#/index?type=5">技能</a>
                    </li>
                </ul>
                <?php if(session('userName')) { ?>
                <ul class="fr">
                    <li class="dropdown ">
                        <img class="per-photo" src="<?php echo session('photo') ?>">
                        <a href=""><?php echo session('userName') ?></a>
                        <ul class="dropdown-menu">
                            <li><a href="index.php?m=home&a=logout&c=login">退出</a></li>
                            <li><a href="/#/userInfo">个人中心</a></li>
                            <li><a href="/#/post">发表</a></li>
                        </ul>
                    </li> 
                </ul>
                <?php }else{ ?>
                <ul class="fr">
                    <li><a href="/#/login">登录</a></li>
                    <li><a href="/#/login">注册</a></li>
                </ul>
              <?php } ?>
            </nav>
        </div>
    </header>

    <!-- 内嵌html -->
    <div ng-view></div> 

    <footer id="footer">
        <div class="copyright">     
            Copyright © 2016-2016 可来居<br>       
            <a href="http://www.miibeian.gov.cn/">粤ICP备16014109号-1</a>  
        </div>      
    </footer>
    <script type="text/javascript">appCommon = angular.module('app', ['ngRoute', '720kb.datepicker', 'ngDialog', 'infinite-scroll']);</script>
    <script type="text/javascript" src="__PUBLIC__/client/js/common/index.route.js"></script>     
    <script type="text/javascript" src="__PUBLIC__/client/js/common/head.controller.js"></script>    
    <script type="text/javascript" src="__PUBLIC__/client/js/userInfo/info.controller.js"></script>    
    <script type="text/javascript" src="__PUBLIC__/client/js/login/login.controller.js"></script>    
    <script type="text/javascript" src="__PUBLIC__/client/js/index/index.controller.js"></script>  
    <script type="text/javascript" src="__PUBLIC__/client/js/post/post.controller.js"></script>  
    <script type="text/javascript" src="__PUBLIC__/client/js/content/content.controller.js"></script>  
    
    <!-- 上传图片 -->
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/ueditor.config.js"></script>
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/ueditor.all.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/zh-cn.js"></script>
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/codemirror.js"></script>
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/ZeroClipboard.js"></script>

    <!-- 日期 -->
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/angular-datepicker.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/client/css/angular-datepicker.css">

    <!-- 弹窗 -->    
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/ngDialog.min.js"></script>

    <!-- 滚动加载 -->    
    <script type="text/javascript" src="__PUBLIC__/client/js/plugin/ng-infinite-scroll.min.js"></script>
</body>
</html>
